package com.jobinsight.util;

import java.util.Map;

public enum ObjectType {
	OBJ, OBJ_PRIM ,FIELD ,ITERABLE ,MAP;
	
    public static ObjectType getType(Object theObject) { 
    	if(theObject instanceof Iterable){
			return ITERABLE;
		} else if(theObject instanceof Map){
			return MAP;
		} else {
			if(theObject==null || theObject.getClass().getCanonicalName().startsWith("java."))
				return OBJ_PRIM;
			else
				return OBJ;
		}
    }
    
    public static boolean isPrimitive(Object theObject){
    	return getType(theObject) == OBJ_PRIM;
    }
    
}